<template>
  <div class="Mask" v-if="isShow">
    <div class="box">
      <input type="button" :value="text" @click="but" />
    </div>
  </div>
</template>

<script>
export default {
  props: {
    isShow: {
      type: Boolean
    },
    text: {
      type: String
    }
  },
  methods: {
    but () {
      this.$emit('update:isShow', !this.isShow)
      this.$emit(
        'update:text',
        this.text === '试试就试试' ? '点我试试' : '试试就试试'
      )
    }
  }
}
</script>

<style scoped>
.Mask {
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  .box {
    width: 400px;
    height: 320px;
    background-color: rgb(240, 240, 240);
    position: absolute;
    left: calc(50% - 200px);
    top: calc(50% - 160px);
    border-radius: 10px;
  }
}

input {
  width: 120px;
  height: 30px;
  display: block;
  margin: 150px auto;
}
</style>
